package com.gxa.service.investment.impl;

import com.gxa.entity.investment.InvestmentPlanChild;
import com.gxa.mapper.commnotice.QueryMapper;
import com.gxa.mapper.investment.InvestmentPlanChildMapper;
import com.gxa.service.investment.InvestmentPlanChildService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author yjl
 * @since 2022-10-21 10:04:31
 */
@Service
public class InvestmentPlanChildServiceImpl extends ServiceImpl<InvestmentPlanChildMapper, InvestmentPlanChild> implements InvestmentPlanChildService {

    @Autowired
    private InvestmentPlanChildMapper investmentPlanChildMapper;

    @Override
    public List<InvestmentPlanChild> queryByInvestmentPlanName(String investmentPlanName) {

        return investmentPlanChildMapper.queryByInvestmentPlanName(investmentPlanName);
    }

    @Override
    public void update(InvestmentPlanChild investmentPlanChild) {
        investmentPlanChildMapper.updateById(investmentPlanChild);
    }

    @Override
    public void delete(int id) {
        investmentPlanChildMapper.deleteById(id);
    }

    @Override
    public List<InvestmentPlanChild> add(InvestmentPlanChild investmentPlanChild) {
        investmentPlanChildMapper.insert(investmentPlanChild);
        String investmentPlanName = investmentPlanChild.getInvestmentPlanName();
        return investmentPlanChildMapper.queryByInvestmentPlanName(investmentPlanName);
    }
}
